<template>
  <view class="page">
    <Header> </Header>
    <view class="page">
      <Header> </Header>
      <view class="main_container">
        <view class="main_content">
          <Breadcrumb :text="'个人评测-对抗赛-学习报告'"> </Breadcrumb>
          <view class="content">
            <view class="box">
              <view class="header">
                <view class="header_left">
                  <view class="title1">
                    <text>试卷总分: {{ totalScore }}分</text>
                    <text>及格分数: {{ passingScore }}分</text>
                    <text>考试时长: {{ duration }}分钟</text>
                  </view>
                  <view class="title2">
                    {{ gameTitle }}
                  </view>
                </view>
                <view class="header_right"> </view>
              </view>
              <view class="info">
                <view class="info_content">
                  <view
                    class="info_box"
                    v-for="item in userList"
                    :key="item.id"
                  >
                    <u-avatar
                      :src="item.headImg"
                      img-mode="fill"
                      :size="60"
                    ></u-avatar>
                    <view>
                      <text>{{ item.loginName }}</text>
                      <text v-if="item.userName">（{{ item.userName }}）</text>
                    </view>
                  </view>
                </view>
              </view>
              <view class="section">
                <PaperRecord
                  ref="paperRecord"
                  v-if="paper"
                  :paper="paper"
                  :exam="exam"
                ></PaperRecord>
              </view>
            </view>
          </view>
        </view>
      </view>
    </view>
  </view>
</template>

<script>
import { taskReportDetail } from "@/api/task";
export default {
  components: {},
  data() {
    return {
      id: "",
      gameTitle: "",
      totalScore: 0,
      passingScore: 0,
      duration: 0,
      paper: null,
      userList: [],
    };
  },
  onLoad(option) {
    this.id = option.id;
    this.init();
  },
  methods: {
    init() {
      let params = {
        id: this.id,
      };
      taskReportDetail(params).then((res) => {
        this.userList = res.data.users;
        this.gameTitle = res.data.gameTitle;
        this.totalScore = res.data.userExam.totalScore;
        this.passingScore = res.data.userExam.passingScore;
        this.duration = res.data.duration;
        this.exam = res.data.userExam;
        this.paper = res.data.testPaper;
      });
    },
  },
};
</script>
<style scoped lang="scss">
@import "./rankReport.scss";
</style>
